package cn.z2huo.leetcode.problem.NO_00010;

public class Main {
    public static void main(String[] args){
        int[] waterArray = {1,8,6,2,5,4,8,3,7};
        int maxVolume = 0;
        int demo;
        for(int i=0; i<waterArray.length-1; i++){
            for(int j=i+1; j<waterArray.length; j++){
                if((demo = (j-i)*Math.min(waterArray[i],waterArray[j]))>maxVolume){
                    maxVolume = demo;
                }
            }
        }
        System.out.println(maxVolume);
    }
}